package com.itheima.order.controller;

import com.itheima.goods.pojo.Order;
import com.itheima.order.service.OrderService;
import entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
@CrossOrigin
public class OrderController {
    @Autowired
    private OrderService orderService;

    //获取订单确认信息(传入商品id)
    @GetMapping("submitInfo/{goodId}")
    public Result findSubmitInfoById(@PathVariable("goodId") Long id) {
        return orderService.findSubmitInfoById(id);
    }

    //新增订单
    @PostMapping("submitOrder")
    public Result submitOrder(@RequestBody Order order){
        return orderService.submitOrder(order);
    }
}